<?php
namespace Admin\Model;

use Think\Model;

class AgentAdminModel extends Model {
	
	protected $_validate = array(
			array('name','require','管理员姓名必须',self::MUST_VALIDATE),
			array('email','','管理员Email已经存在',self::EXISTS_VALIDATE, 'unique'),
			array('email','email','管理员Email格式不正确',self::EXISTS_VALIDATE),
	);
	
	protected $_auto = array(
			array('password', 'getPassword', self::MODEL_BOTH, 'callback'),
			array('last_login_time', 'time', self::MODEL_UPDATE, 'function'),
			array('last_login_ip', 'get_client_ip', self::MODEL_UPDATE, 'function'),
	);
	
	public function getPassword() {
		$password = I("password");
	    if(!isset($_REQUEST['password']) or empty($password)) return false;
		return hash_pwd($password);
	}
	
}